package singleton;

/**
 * 懒汉式(线程不安全)
 * 优点：懒加载。
 * 缺点：线程不安全。
 * Created by thiswhyme on 2019/03/15.
 */
public class LazySingleton {

    private static LazySingleton instance;

    private LazySingleton() {

    }

    public static LazySingleton getInstance() {
        if (null == instance) {
            instance = new LazySingleton();
        }
        return instance;
    }
}
